package com.lifeng.utils;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;

/**
 * @author:lifeng
 * @date:2020/4/9 16:17
 */
@Slf4j
public class HttpResponseUtil {
    public static void writeClient(HttpServletResponse response,String data){
        OutputStream out = null;
        try {
            response.setContentType("text/html;charset=utf-8");
            response.setCharacterEncoding("UTF-8");
            out = response.getOutputStream();
            out.write(data.getBytes("UTF-8"));
            out.close();
        }catch(Exception e){
            log.warn("输出客户端异常",e);
        }
    }
}
